<?php


namespace plugin\agent\app\admin\controller;

use app\common\controller\BaseAdminController;
use plugin\agent\app\admin\logic\AgentOrderLogic;
use think\db\Query;

/**
 * 分销订单
 * Class AgentWithdrawalController
 * @package plugin\agent\app\admin\controller
 */
class AgentOrderController extends BaseAdminController
{
    protected function init()
    {
        parent::init();
        $this->logic = new AgentOrderLogic();
    }

    public function list()
    {
        $query = $this->logic->search($this->searchWhere());
        $query->order("id desc");
        $query->with([
            "buyuser" => function (Query $query) {
                $query->field(['id', 'nickname']);
            },
        ]);
        $data = $this->logic->getPageList($query);
        return $this->success($data);
    }

}